home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / intrinsics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  4.3 KB  |  90 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     intrinsics.h
  4.     Declarations of intrinsic functions for the MrC[pp] compilers.
  5.     
  6.     Copyright Apple Computer,Inc.  1996
  7.     All rights reserved
  8.  
  9.     Instruction intrinsics are pseudo-functions which may be expanded  
  10.     inline by the compiler to provide direct access to selected PowerPC 
  11.     machine instructions.  If compiler support is not provided for inline
  12.     expansion then references to these functions will generate external 
  13.     function references.  MrC[pp] versions 2.0 and later recognize the
  14.     intrinsics and perform inlining but earlier versions of MrC do not.
  15.     
  16.     With exceptions noted below, the function's name and prototype follow 
  17.     from the machine instruction's name and operands.  The function return 
  18.     value corresponds to the instruction's destination operand, e.g. FABS; 
  19.     the function returns void if there is no destination operand, e.g. STHBRX.  
  20.     The function's arguments agree in number and correspond with the
  21.     instruction's source operands.  The correspondence is also shown by 
  22.     the function argument names in relation to the instruction template 
  23.     in the comment next to each function.
  24.  
  25.     The PowerPC architecture manuals describe these instructions in detail.
  26.     
  27.     Naming exception: __setflm does not correspond to a machine instruction.
  28.     It uses two instructions, MFFS and MTFSF, to store the low 32 bits of 
  29.     its double argument into FPSCR and return the previous value of FPSCR 
  30.     in the low 32 bits of its return value.
  31.  
  32.     
  33. ************************************************************/
  34.  
  35. #ifndef __INTRINSICS__
  36. #define __INTRINSICS__
  37.  
  38. #include <ConditionalMacros.h>
  39.  
  40. #if        GENERATINGPOWERPC
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. extern int __cntlzw (unsigned int rS);                                /* CNTLZW    rA,rS            */
  47. extern void __dcbf (void * rA, int rB);                                /* DCBF        rA,rB            */
  48. extern void __dcbt (void *rA, int rB);                                /* DCBT        rA,rB            */
  49. extern void __dcbst (void *rA, int rB);                                /* DCBST    rA,rB            */
  50. extern void __dcbtst (void *rA, int rB);                            /* DCBTST    rA,rB            */
  51. extern void __dcbz (void *rA, int rB);                                /* DCBZ        rA,rB            */
  52. extern void __eieio (void);                                            /* EIEIO                    */
  53. extern double __fabs (double frB);                                    /* FABS        frD,frB            */
  54. extern double __fmadd (double frA,double frC,double frB);            /* FMADD    frD,frA,frC,frB    */
  55. extern double __fmsub (double frA,double frC,double frB);            /* FMSUB    frD,frA,frC,frB    */    
  56. extern double __fnabs (double);                                        /* FNABS    frD,frB            */
  57. extern double __fnmadd(double frA,double frC,double frB);            /* FNMADD    frD,frA,frC,frB */
  58. extern double __fnmsub(double frA,double frC,double frB);            /* FNMSUB    frD,frA,frC,frB */
  59. extern float __fmadds(float frA,float frC,float frB);                /* FMADDS    frD,frA,frC,frB */
  60. extern float __fmsubs(float frA,float frC,float frB);                /* FMSUBS    frD,frA,frC,frB */
  61. extern float __fnmadds(float frA,float frC,float frB);                /* FNMADDS    frD,frA,frC,frB */
  62. extern float __fnmsubs(float frA,float frC,float frB);                /* FNMSUBS    frD,frA,frC,frB */
  63. extern double __frsqrte (double frB);                                /* FRSQRTE    frD,frB            */ 
  64. extern float __fres (float frB);                                    /* FRES        frD,frB            */
  65. extern double __fsel (double frA,double frC,double frB);            /* FSEL        frD,frA,frC,frB    */
  66. extern double __fsqrt (double frB);                                    /* FSQRT    frD,frB            */
  67. extern float __fsqrts (float frB);                                    /* FSQRTS    frD,frB            */
  68. extern void __icbi (void *rA, int rB);                                /* ICBI        rA,rB            */
  69. extern void __isync (void);                                            /* ISYNC                    */
  70. extern unsigned int __lhbrx (void *rA, int rB);                        /* LHBRX    rD,rA,rB        */
  71. extern unsigned int __lwbrx (void *rA, int rB);                        /* LWBRX    rD,rA,rB        */
  72. extern double __mffs (void);                                        /* MFFS        frD                */
  73. extern unsigned int __mfxer(void);                                    /* MFSPR    rD,1            */
  74. extern void __mtfsb0 (unsigned int crbD);                            /* MTFSB0    crbD            */
  75. extern void __mtfsb1 (unsigned int crbD);                            /* MTFSB1    crbD            */
  76. extern int __mulhw (int rA, int rB);                                /* MULHW    rD,rA,rB        */
  77. extern unsigned int __mulhwu (unsigned int rA, unsigned int rB);    /* MULHWU    rD,rA,rB        */
  78. extern double __setflm (double frB);                                /* MFFS    frD; MTFSF 255,frB    */
  79. extern void __sthbrx (unsigned short rS, void *rA, int rB);            /* STHBRX    rS,rA,rB        */
  80. extern void __stwbrx (unsigned int rS, void *rA, int rB);            /* STWBRX    rS,rA,rB        */
  81. extern void __sync (void);                                            /* SYNC                        */
  82.  
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86.  
  87. #endif    /* GENERATINGPOWERPC */
  88.  
  89. #endif /* __INTRINSICS__ */
  90.